package com.demo.spring.annoinit;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {

	public static void main(String[] args) {
        // 用我们的配置文件来启动一个 ApplicationContext
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("com.demo.spring.annoinit");
        System.out.println("context 启动成功");

        StudentService studentService = context.getBean(StudentService.class);
        studentService.play();

        PersonService personService = context.getBean(PersonService.class);
        PersonImportService personImportService = context.getBean(PersonImportService.class);
        personService.say();
        personImportService.say();

        DataSource dataSource = context.getBean(DataSource.class);
        System.out.println(dataSource.getDriverClass());
    }

}
